﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SummerTraining
{
    class Animal
    {
        public virtual void Eat(Food a)
        {
            Console.WriteLine("动物吃掉了食物");
            a.Consume();
        }

    }
    class Dog : Animal
    {
        public void Eat(Meat a)
        {
            Console.WriteLine("狗吃掉了肉");
            a.Consume();
        }

        public override void Eat(Food a)
        {
            Console.WriteLine("狗吃掉了食物");
            a.Consume();
        }
    }

    class Food
    {
        public virtual void Consume()
        {
            Console.WriteLine("消耗了食物");
        }
    }
    class Meat : Food
    {
        public override void Consume()
        {
            Console.WriteLine("消耗了肉");
        }
    }
}
